package com.roadjava.tutor.bean.enums;

import org.apache.commons.lang3.StringUtils;

/**
 * 订单状态
 * @author zhaodaowen
 * @see <a href="http://www.roadjava.com">乐之者java</a>
 */
public enum OrderStatusEnum {
    WAIT_FOR_AGREE("wait_for_agree","等待同意"),
    ING("ing","进行中"),
    DONE("done","已完结");

    private String status;
    private String desc;

    OrderStatusEnum(String status, String desc) {
        this.status = status;
        this.desc = desc;
    }

    public static String getDescByStatus(String status) {
        if (StringUtils.isBlank(status)) {
            return null;
        }
        for (OrderStatusEnum e : values()) {
            if (status.equals(e.getStatus())) {
                return e.getDesc();
            }
        }
        return null;
    }

    public String getDesc() {
        return desc;
    }

    public String getStatus() {
        return status;
    }
}
